Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  List  Dependent  Services  for  All  Services  

 Content of List Dependent Services for All Services.vbs
MD5 Hash: C248CF2715D7119F6F449C3A0F2331E9
' Description: Enumerates dependent services for all the services installed on a computer and writes that information to a text file.


Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = _
objFSO.OpenTextFile("c:\scripts\service_dependencies.csv", _
ForAppending, True)
objLogFile.Write("Service Dependencies")
objLogFile.Writeline

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service")

For Each objService in colListofServices
objServiceRegistryName = objService.Name
objServiceDisplayName = objService.DisplayName

Set colServiceList = objWMIService.ExecQuery("Associators of " _
& "{Win32_Service.Name='" & objServiceRegistryName & "'} Where AssocClass=Win32_DependentService Role=Antecedent" )


If colServiceList.Count = 0 then
objLogFile.Write(objServiceDisplayName) & ", None"
objLogFile.Writeline
Else
For Each objDependentService in colServiceList
objLogFile.Write(objServiceDisplayName) & ","
objLogFile.Write(objDependentService.DisplayName)
Next
objLogFile.WriteLine
End If
Next
objLogFile.Close

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a